Interaction.Timestamp Property

Gets or sets the point in time at which the interaction was first made available to the learner.

Parent Type: Interaction

Namespace: Microsoft.LearningComponents.DataModel

Assembly: Microsoft.LearningComponents.dll

Syntax
C#

public string Timestamp

{ get; set; }
Exceptions
Exception type Condition
InvalidOperationException

Thrown if this LearningDataModel object cannot be written to.

ArgumentOutOfRangeException

In SCORM 2004 packages, thrown if the year is less than 1970 or greater than 2038.

FormatException

Thrown if the passed string is not in the correct format.

Remarks

In SCORM 2004, this corresponds to cmi.interactions.n.timespan.

In SCORM 1.2, this corresponds to cmi.interactions.n.time.

This property represents the point in time which the interaction was first made available to the learner for interaction and response.

This field is in the same format as the SCORM specification for timestamps. This may be achieved easily within C# by code like the example.

Example

C#
    // this saves the timestamp with the current timezone information
    session.CurrentActivityDataModel.Interactions[0].Timestamp = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.ffzzz");
 
    // this saves a UTC timestamp, which is recommended to avoid issues with timezones
    session.CurrentActivityDataModel.Interactions[0].Timestamp = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.ffZ");
 
    // this saves timestamp with no specific timezone information
    session.CurrentActivityDataModel.Interactions[0].Timestamp = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
 
    // In SCORM 1.2, the timestamp is simply a 24-hour clock, so the following format should be used
    session.CurrentActivityDataModel.Interactions[0].Timestamp = DateTime.Now.ToString("HH:mm:ss");